<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NBooks.Core.Models" assembly="NBooks.Core">
	<class name="SalesOrder" table="sales_orders">
		<id name="Id" column="id">
			<generator class="identity" />
		</id>
		<property name="Date" column="date" />
		<many-to-one name="Customer" class="Customer" column="customer_id" />
		<bag name="Items" cascade="all">
			<key column="sales_order_id" />
			<one-to-many class="SalesOrderItem" />
		</bag>
	</class>
	<class name="SalesOrderItem" table="sales_orders_items">
		<id name="Id" column="id">
			<generator class="identity" />
		</id>
		<many-to-one name="Order" class="SalesOrder" column="sales_order_id" />
		<many-to-one name="Item" class="Item" column="item_id" />
		<property name="Quantity" column="quantity" />
	</class>
</hibernate-mapping>